package com.dhq.myapp.util.dialog.custom

import android.content.Context
import com.dhq.myapp.util.dialog.DialogBuilder
import com.dhq.myapp.util.dialog.ViewHolder
import com.lxj.xpopup.core.BottomPopupView

/**
 * DESC
 * Created by douhaoqiang on 2025/10/15.
 */
class CustomBottomPopup : BottomPopupView {
    var mBuilder: DialogBuilder? = null

    constructor(context: Context) : super(context)

    constructor(builder: DialogBuilder) : super(builder.context!!) {
        this.mBuilder = builder
    }

    override fun getImplLayoutId(): Int {
        return mBuilder!!.layoutId
    }

    override fun onCreate() {
        super.onCreate()

        mBuilder!!.getConvert()!!.convertView(ViewHolder.create(this), this)
    }

    override fun onShow() {
        super.onShow()
    }

    //        @Override
    //        protected int getMaxHeight() {
    //            return 200;
    //        }
    //
    //返回0表示让宽度撑满window，或者你可以返回一个任意宽度
    //        @Override
    //        protected int getMaxWidth() {
    //            return 1200;
    //        }
    override fun getMaxHeight(): Int {
        return super.getMaxHeight()
    }
}